<?php
 header("Content-Type:text/html;charset=utf-8");//防止网页中文乱码
// //接受提交的数据
//echo $_REQUEST['username'];
//echo "<br/>";
//echo $_REQUEST['message'];
//echo "<br/>";
//echo $_REQUEST['sex'];
//echo "<br/>";
//echo $_REQUEST['imgurl'];
 //往数据表里添加一条留言
 //(1)连接数据库
 require 'dbcon.php';
 $e_name=$_REQUEST['e_name'];
 $e_dept=$_REQUEST['e_dept'];//获取用户呢称
 $e_img=$_REQUEST['e_img'];
 $date_of_birth=$_REQUEST['date_of_birth'];
 $date_of_entry=$_REQUEST['date_of_entry'];
 date_default_timezone_set('Asia/Shanghai');
 $sql="insert into tb_emp(e_name,e_dept,e_img,date_of_birth,date_of_entry) values('{$e_name}','{$e_dept}','{$e_img}','{$date_of_birth}','{$date_of_entry}')";//写SQL语句
 $rs=$db->query($sql);//执行SQL语句
 if  ($rs==true)
 {
     echo "<script language='javascript'type='text/javascript'>";
     echo "alert('留言成功');";
     echo "window.location.href='index.php';";
     echo "</script>";
 }
 else {
     echo "<script language='javascript'type='text/javascript'>";
     echo "alert('留言失败');";
     echo "window.location.href='index.php';";
     echo "</script>";
}